---
sidebar_position: 1
slug: /
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Getting started

## What is React Native Worklets?

React Native Worklets is a library that allows you to run JavaScript code in parallel on multiple threads and runtimes.

While the library is in transitional period where we hone the API, all its features are functionally stable and ready to use in production.

## Prerequisites

:::info
Worklets library isn't tested on the Legacy Architecture (Paper). We highly recommend migrating to the [New Architecture (Fabric)](https://reactnative.dev/architecture/landing-page) prior to using Worklets.
:::

## Installation

### Step 1: Install the package

Install `react-native-worklets` package from npm:

<Tabs groupId="package-managers">
  <TabItem value="npm" label="NPM">
    ```bash
    npm install react-native-worklets
    ```

  </TabItem>
  <TabItem value="yarn" label="YARN">
    ```bash
    yarn add react-native-worklets
    ```

  </TabItem>
</Tabs>

### Step 2: Rebuild native dependencies

Run prebuild to update the native code in the `ios` and `android` directories.

<Tabs groupId="package-managers">
  <TabItem value="npm" label="NPM">
    ```bash
    npx expo prebuild
    ```
  </TabItem>
  <TabItem value="yarn" label="YARN">
    ```bash
    yarn expo prebuild
    ```
  </TabItem>
</Tabs>

And that's it! Worklets is now configured in your Expo project.

### React Native Community CLI

When using [React Native Community CLI](https://github.com/react-native-community/cli), you also need to manually add the `react-native-worklets/plugin` plugin to your `babel.config.js`.

```js {7}
  module.exports = {
    presets: [
      ... // don't add it here :)
    ],
    plugins: [
      ...
      'react-native-worklets/plugin',
    ],
  };
```

<details>
<summary>Why do I need this?</summary>

In short, the Worklets babel plugin automatically converts special JavaScript functions (called [worklets](/docs/fundamentals/glossary#worklet)) to allow them to be passed and run on the [Worklet Runtimes](/docs/fundamentals/runtimeKinds#worklet-runtime)

Since [Expo SDK 54](https://expo.dev/changelog/sdk-54-beta#notable-breaking-changes), the Expo starter template includes the Worklets babel plugin by default.

To learn more about the plugin head onto to [Worklets babel plugin](/docs/worklets-babel-plugin/about) section.

</details>

#### Clear Metro bundler cache (recommended)

<Tabs groupId="package-managers">
  <TabItem value="npm" label="NPM">
    ```bash
    npm start -- --reset-cache
    ```
  </TabItem>
  <TabItem value="yarn" label="YARN">
    ```bash
    yarn start --reset-cache
    ```
  </TabItem>
</Tabs>


#### Android

No additional steps are necessary.

#### iOS

While developing for iOS, make sure to install [pods](https://cocoapods.org/) first before running the app:

```bash
cd ios && pod install && cd ..
```